package com.bluefox.uac.security;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.Setter;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

/**
 * @version v1.0
 * @ProjectName: spring-demo
 * @ClassName: LoginUserBean
 * @Description: TODO(一句话描述该类的功能)
 * @Author: sf
 * @Date: 2019/11/22 21:22
 */
@Setter
@Getter
@JsonInclude(value = JsonInclude.Include.NON_NULL)
public class LoginUserBean implements UserDetails, Serializable {
    // 更改变量
    private static final long serialVersionUID = 210507804672611263L;
    /**
     * 用户Id
     */
    @JsonProperty("userId")
    private String userId;
    /**
     * 用户名
     */
    @JsonProperty("username")
    private String username;
    /**
     * 用户显示姓名
     */
    @JsonProperty("fullname")
    private String fullname;

    /**
     * 用户组织机构代码
     */
    @JsonProperty("organCode")
    private String organCode;

    private String password;
    /**
     * 用户角色列表
     */
    @JsonProperty("roles")
    private Collection<SimpleGrantedAuthority> roles;

    /**
     * 用户角色Code列表
     */
    @JsonProperty("roleCodes")
    private List<String> roleCodes;

    @JsonProperty("province")
    private String province;

    @JsonProperty("city")
    private String city;

    @JsonProperty("country")
    private String country;

    /**
     * 用户类型
     */
    @JsonProperty("accountType")
    private String accountType;

    /**
     * 企业用户wryKeyId
     */
    @JsonProperty("wryKeyId")
    private Long wryKeyId;

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return null;
    }

    @Override
    public String getPassword() {
        return password;
    }

    @Override
    public boolean isAccountNonExpired() {
        return false;
    }

    @Override
    public boolean isAccountNonLocked() {
        return false;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return false;
    }

    @Override
    public boolean isEnabled() {
        return false;
    }
}
